home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / GXMath.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  5.0 KB  |  144 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        GXMath.p
  3.  
  4.      Contains:    QuickDraw GX math routine interfaces.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT GXMath;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __GXMATH__}
  28. {$SETC __GXMATH__ := 1}
  29.  
  30. {$I+}
  31. {$SETC GXMathIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MACTYPES__}
  38. {$I MacTypes.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __FIXMATH__}
  41. {$I FixMath.p}
  42. {$ENDC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49.  
  50.  
  51. TYPE
  52.     gxPointPtr = ^gxPoint;
  53.     gxPoint = RECORD
  54.         x:                        Fixed;
  55.         y:                        Fixed;
  56.     END;
  57.  
  58.     gxColorValue                        = UInt16;
  59.     gxPolarPtr = ^gxPolar;
  60.     gxPolar = RECORD
  61.         radius:                    Fixed;
  62.         angle:                    Fixed;
  63.     END;
  64.  
  65.     gxMappingPtr = ^gxMapping;
  66.     gxMapping = RECORD
  67.         map:                    ARRAY [0..2,0..2] OF Fixed;
  68.     END;
  69.  
  70.  
  71.  
  72. CONST
  73.     gxColorValue1                = $0000FFFF;                    {  gxColorValue 1.0  }
  74.  
  75.     gxPositiveInfinity            = $7FFFFFFF;                    {  for Fixed and Fract  }
  76.     gxNegativeInfinity            = $80000000;                    {  for Fixed and Fract  }
  77.  
  78.  
  79. FUNCTION CopyToMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  80. FUNCTION InvertMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  81. FUNCTION MapMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  82. FUNCTION MoveMapping(VAR target: gxMapping; hOffset: Fixed; vOffset: Fixed): gxMappingPtr; C;
  83. FUNCTION MoveMappingTo(VAR target: gxMapping; hPosition: Fixed; vPosition: Fixed): gxMappingPtr; C;
  84. FUNCTION NormalizeMapping(VAR target: gxMapping): gxMappingPtr; C;
  85. FUNCTION RotateMapping(VAR target: gxMapping; angle: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  86. FUNCTION ScaleMapping(VAR target: gxMapping; hFactor: Fixed; vFactor: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  87. FUNCTION ResetMapping(VAR target: gxMapping): gxMappingPtr; C;
  88. FUNCTION SkewMapping(VAR target: gxMapping; skewX: Fixed; skewY: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  89. PROCEDURE MapPoints({CONST}VAR source: gxMapping; count: LONGINT; VAR vector: gxPoint); C;
  90. FUNCTION FirstBit(x: UInt32): INTEGER; C;
  91. FUNCTION WideScale({CONST}VAR source: wide): INTEGER; C;
  92. FUNCTION LinearRoot(first: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  93. FUNCTION QuadraticRoot(first: Fixed; control: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  94. FUNCTION PolarToPoint({CONST}VAR ra: gxPolar; VAR xy: gxPoint): gxPointPtr; C;
  95. FUNCTION PointToPolar({CONST}VAR xy: gxPoint; VAR ra: gxPolar): gxPolarPtr; C;
  96. FUNCTION FractCubeRoot(source: Fract): Fract; C;
  97. FUNCTION FractDivide(dividend: Fract; divisor: Fract): Fract; C;
  98. FUNCTION FractMultiply(multiplicand: Fract; multiplier: Fract): Fract; C;
  99. FUNCTION FractSineCosine(degrees: Fixed; VAR cosine: Fract): Fract; C;
  100. FUNCTION FractSquareRoot(source: Fract): Fract; C;
  101. FUNCTION FixedDivide(dividend: Fixed; divisor: Fixed): Fixed; C;
  102. FUNCTION FixedMultiply(multiplicand: Fixed; multiplier: Fixed): Fixed; C;
  103. { This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides }
  104. FUNCTION MultiplyDivide(source: LONGINT; multiplier: LONGINT; divisor: LONGINT): LONGINT; C;
  105. FUNCTION Magnitude(deltaX: LONGINT; deltaY: LONGINT): UInt32; C;
  106. FUNCTION VectorMultiplyDivide(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; divisor: LONGINT): LONGINT; C;
  107.  
  108.  
  109.  
  110. { wide operations are defined within FixMath.h only for PowerPC }
  111. {$IFC NOT TARGET_CPU_PPC }
  112. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  113. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  114. FUNCTION WideNegate(VAR target: wide): widePtr; C;
  115. FUNCTION WideShift(VAR target: wide; shift: LONGINT): widePtr; C;
  116. FUNCTION WideSquareRoot({CONST}VAR source: wide): UInt32; C;
  117. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  118. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): widePtr; C;
  119. { returns the quotient }
  120. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  121. { quotient replaces dividend }
  122. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): widePtr; C;
  123. {$ENDC}
  124.  
  125.  
  126.  
  127. FUNCTION VectorMultiply(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; VAR dot: wide): widePtr; C;
  128. FUNCTION RandomBits(count: LONGINT; focus: LONGINT): UInt32; C;
  129. PROCEDURE SetRandomSeed({CONST}VAR seed: wide); C;
  130. FUNCTION GetRandomSeed(VAR seed: wide): widePtr; C;
  131.  
  132.  
  133.  
  134. {$ALIGN RESET}
  135. {$POP}
  136.  
  137. {$SETC UsingIncludes := GXMathIncludes}
  138.  
  139. {$ENDC} {__GXMATH__}
  140.  
  141. {$IFC NOT UsingIncludes}
  142.  END.
  143. {$ENDC}
  144.